﻿<%@ Page Title="" Language="C#" MasterPageFile="~/master.master" AutoEventWireup="true"
    CodeFile="User.aspx.cs" Inherits="User" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContentPlaceHolder" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="Server">
    <style type="text/css">
        p
        {
            line-height: 1.9em;
            color: #525252;
            font-size: 15px;
        }
    </style>
    <script type="text/javascript">
        function funGoTab(tabID) {
            if (tabID == "2") {
                document.getElementById("ctl00_ContentPlaceHolder1_tr_Login").style.display = "";
                document.getElementById("ctl00_ContentPlaceHolder1_tr_RegisterUser").style.display = "none";
                document.getElementById("ctl00_ContentPlaceHolder1_txtEmailAddress").focus();

            }
            else {
                document.getElementById("ctl00_ContentPlaceHolder1_tr_Login").style.display = "none";
                document.getElementById("ctl00_ContentPlaceHolder1_tr_RegisterUser").style.display = "";
                document.getElementById("ctl00_ContentPlaceHolder1_txtUserFullName").focus();
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td style="height: 20px;" colspan="3">
            </td>
        </tr>
        <tr>
            <td style="height: 50px; text-align: center; background-color: #4a4a4a; color: #fff;
                width: 45%; cursor: pointer; font-weight: bold;" align="center" onclick="funGoTab('1')">
                مستخدم جديد
            </td>
            <td style="width: 10%;">
            </td>
            <td style="height: 50px; text-align: center; background-color: #4a4a4a; color: #fff;
                width: 45%; cursor: pointer; font-weight: bold;" align="center" onclick="funGoTab('2')">
                الدخول الى الحساب
            </td>
        </tr>
        <tr>
            <td style="height: 20px;" colspan="3">
            </td>
        </tr>
        <tr style="display: ;" id="tr_Login" runat="server">
            <td colspan="3">
                <div class="cat_listing">
                    <div class="header">
                        <h1>
                            <a style="text-decoration: underline; color: slateblue;" href="javascript:void(0)">
                                الدخول الى الحساب</a></h1>
                    </div>
                    <!-- #header -->
                    <div class="content" style="padding-right: 20px;">
                        <table border="0" width="100%" cellpadding="0" cellspacing="5">
                            <tr>
                                <td>
                                    &nbsp;
                                </td>
                                <td colspan="2">
                                    <div id="fb-root">
                                    </div>
                                    <img src="images/connect-facebook.png" alt="ArabiSky - login By Facebook" onclick="loginByFacebook();" style="cursor:pointer;" />
                                    <script type="text/javascript">
                                        window.fbAsyncInit = function () {
                                            FB.init({ appId: '384070111692466',
                                                status: true, // check login status
                                                cookie: true, // enable cookies to allow the server to access the session
                                                xfbml: true, // parse XFBML
                                                oauth: true // enable OAuth 2.0
                                            });
                                        };
                                        (function () {
                                            var e = document.createElement('script'); e.async = true;
                                            e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
                                            document.getElementById('fb-root').appendChild(e);
                                        } ());

                                        function loginByFacebook() {
                                            FB.login(function (response) {
                                                if (response.authResponse) {
                                                    FacebookLoggedInner(response);
                                                } else {
                                                    console.log('User cancelled login or did not fully authorize.');
                                                }
                                            }, { scope: 'user_birthday,user_about_me,user_hometown,user_location,email,publish_stream' });
                                        }

                                        function FacebookLoggedInner(response) {
                                            var loc = '/facebookServicePage?action=login';
                                            if (loc.indexOf('?') > -1)
                                                window.location = loc + '&authprv=facebook&access_token=' + response.authResponse.accessToken;
                                            else
                                                window.location = loc + '?authprv=facebook&access_token=' + response.authResponse.accessToken;
                                        }
                                    </script>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3" style="height: 10px; border-bottom: 1px solid #ccc;">
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3" style="height: 10px;">
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 130px;">
                                    البريد الإلكتروني:
                                </td>
                                <td style="width: 280px;">
                                    <asp:TextBox runat="server" ID="txtEmailAddress" ValidationGroup="login" Width="250"
                                        Height="25"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="rfvUserEmailAddress" ValidationGroup="login" runat="server"
                                        ControlToValidate="txtEmailAddress" ErrorMessage="البريد الإلكتروني إجباري"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 130px;">
                                    كلمة المرور:
                                </td>
                                <td style="width: 280px;">
                                    <asp:TextBox runat="server" ID="txtPassword" ValidationGroup="login" TextMode="Password"
                                        Width="250" Height="25"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="rfvPassword" ValidationGroup="login" runat="server"
                                        ControlToValidate="txtPassword" ErrorMessage="كلمة المرور إجبارية"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr style="height: 30px;">
                                <td style="width: 130px;">
                                    &nbsp;
                                </td>
                                <td style="width: 280px;">
                                    <asp:CheckBox runat="server" ID="cboxSaveAuth" Text=" تذكرني " />
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 130px;">
                                    &nbsp;
                                </td>
                                <td style="width: 280px;">
                                    <asp:Button ID="btnSubmit" runat="server" Text="دخول" ValidationGroup="login" Style="height: 30px;
                                        width: 100px; background-color: #ccc; border: 1px solid #bbb; cursor: pointer;"
                                        OnClick="btnSubmit_Click" />
                                </td>
                                <td>
                                    <a href="forgetPassword">إسترجاع كلمة المرور</a>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 130px;">
                                    &nbsp;
                                </td>
                                <td style="width: 280px;" colspan="2">
                                    <span id="spUserLogin" runat="server"></span>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </td>
        </tr>
        <tr style="display: none;" id="tr_RegisterUser" runat="server">
            <td colspan="3">
                <div class="cat_listing">
                    <div class="header">
                        <h1>
                            <a style="text-decoration: underline; color: slateblue;" href="javascript:void(0)"">
                                مستخدم جديد</a></h1>
                    </div>
                    <!-- #header -->
                    <div class="content">
                        <table border="0" width="100%" cellpadding="0" cellspacing="5">
                            <tr>
                                <td>
                                    &nbsp;
                                </td>
                                <td colspan="2">
                                    <img src="images/connect-facebook.png" alt="ArabiSky - login By Facebook" onclick="NewUserByFacebook();" style="cursor:pointer;" />
                                    <script type="text/javascript">
                                        window.fbAsyncInit = function () {
                                            FB.init({ appId: '384070111692466',
                                                status: true, // check login status
                                                cookie: true, // enable cookies to allow the server to access the session
                                                xfbml: true, // parse XFBML
                                                oauth: true // enable OAuth 2.0
                                            });
                                        };
                                        (function () {
                                            var e = document.createElement('script'); e.async = true;
                                            e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
                                            document.getElementById('fb-root').appendChild(e);
                                        } ());

                                        function NewUserByFacebook() {
                                            FB.login(function (response) {
                                                if (response.authResponse) {
                                                    NewUserByFacebook_Inner(response);
                                                } else {
                                                    console.log('User cancelled login or did not fully authorize.');
                                                }
                                            }, { scope: 'user_birthday,user_about_me,user_hometown,user_location,email,publish_stream' });
                                        }

                                        function NewUserByFacebook_Inner(response) {
                                            var loc = '/facebookServicePage?action=newUser';
                                            if (loc.indexOf('?') > -1)
                                                window.location = loc + '&authprv=facebook&access_token=' + response.authResponse.accessToken;
                                            else
                                                window.location = loc + '?authprv=facebook&access_token=' + response.authResponse.accessToken;
                                        }
                                    </script>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3" style="height: 10px; border-bottom: 1px solid #ccc;">
                                </td>
                            </tr>
                            <tr>
                                <td colspan="3" style="height: 10px;">
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 130px;">
                                    الإسم الرباعي:
                                </td>
                                <td style="width: 280px;">
                                    <asp:TextBox runat="server" ID="txtUserFullName" ValidationGroup="signup" Width="250"
                                        Height="25"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="rfvUserFullName" ValidationGroup="signup" runat="server"
                                        ControlToValidate="txtUserFullName" ErrorMessage="الإسم إجباري"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 130px;">
                                    البريد الإلكتروني:
                                </td>
                                <td style="width: 280px;">
                                    <asp:TextBox runat="server" ID="txtUserEmailAddress" ValidationGroup="signup" Width="250"
                                        Height="25"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="rfvEmailADdress" ValidationGroup="signup" runat="server"
                                        ControlToValidate="txtUserEmailAddress" ErrorMessage="البريد الإلكتروني إجباري"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 130px;">
                                    كلمة المرور:
                                </td>
                                <td style="width: 280px;">
                                    <asp:TextBox runat="server" ID="txtUserPassword" ValidationGroup="login" TextMode="Password"
                                        Width="250" Height="25"></asp:TextBox>
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ID="rfvUserPassword" ValidationGroup="signup" runat="server"
                                        ControlToValidate="txtUserPassword" ErrorMessage="كلمة المرور إجبارية"></asp:RequiredFieldValidator>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 130px;">
                                    &nbsp;
                                </td>
                                <td style="width: 280px;">
                                    <asp:Button ID="btnNewUser" runat="server" Text="تسجيل" ValidationGroup="signup"
                                        Style="height: 30px; width: 100px; background-color: #ccc; border: 1px solid #bbb;
                                        cursor: pointer;" OnClick="btnNewUser_Click" />
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 130px;">
                                    &nbsp;
                                </td>
                                <td style="width: 280px;" colspan="2">
                                    <span id="spUserRegisterMessage" runat="server"></span>
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </td>
        </tr>
    </table>
</asp:Content>
